<?php
/**
 * Created by PhpStorm.
 * 人气推荐活动类
 * User: allen.qiang
 * Date: 14-11-14
 * Time: 下午15:20
 */
quanli_require('module/base/activity/activityConfig.class.php');

class activityPopularity {

    /**
     * 得到人气推荐活动的信息
     * @return $item_arry
     * @author  20141114 allen.qiang <allen.qiang@fistforward.com>
     */
    public function popularity_master(){
        global $G_SHOP;

        //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<得到活动的结束时间和三款蛋糕已售出数量>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        $sql_master="SELECT endTime,eventsID,eventsName,number,sourceID FROM `activity_events` WHERE sourceID='888'";
        $temp_item_master = &$G_SHOP->DBCA->stmt_query($sql_master);
        $endtime=null;//活动结束时间
        $number_n03=3953933;//蓝莓轻乳拿破仑已售蛋糕数量
        $number_j07=2301875;//香溢新芝已售蛋糕数量
        $number_c03=1823616;//蔓越莓红丝绒已售蛋糕数量
        if($temp_item_master){
            foreach ($temp_item_master as &$item) {
                if($item->eventsID=="N03")
                    $number_n03=$item->number;
                else if($item->eventsID=="J07")
                    $number_j07=$item->number;
                else if($item->eventsID=="C03")
                    $number_c03=$item->number;
                $endtime=$item->endTime;
            }

        }
        //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<得到活动的结束时间和三款蛋糕已售出数量>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

        //人气推荐活动信息数组
        $item_array = array(
            'endtime'	    => 	$endtime,
            'number_n03'	    => 	$number_n03,
            'number_j07'	    => 	$number_j07,
            'number_c03'   => 	$number_c03
        );

        return $item_array;

    }

} 